package com.woniu.supermarket.mapper;

import com.woniu.supermarket.entity.Employee;
import com.woniu.supermarket.vo.EmployeeVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface EmployeeMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(EmployeeVo record);

    Employee selectByPrimaryKey(Integer id);

    List<Employee> selectAll();

    int updateByPrimaryKey(Employee record);
    @Select("select * from t_employee where username = #{username}")
    Employee selectByName(String username);

    int deleteBatchEmp(int[] ids);

    List<EmployeeVo> selectByCons(@Param("employeeNumber") String employeeNumber, @Param("status") Integer status);
    //给员工赋值多个角色
    void insertRoleForEmployee(@Param("eid") Integer id,@Param("ids") List<Integer> rolesIds);
    //修改员工对象
    int update(EmployeeVo employeeVo);
    //根据员工id删除员工绑定的角色
    @Delete("delete from t_emplyee_role where employee_id = #{id}")
    void deleteEmpRoleByEmpId(Integer id);
    //解除员工与角色绑定
    @Delete("delete from t_emplyee_role where employee_id = #{id}")
    void deleteEmployeeRoleById(Integer id);
}